Learn R Programming

SmoothHazard (version 1.0.9)

survival model: Fit a survival model

Description

Fit a survival model using either a semi-parametric approach (penalized likelihood with an approximation of the hazard function by linear combination of M-splines) or a parametric approach (specifying a Weibull distribution on the hazard function). Left-truncated, right-censored, and interval-censored data are allowed.

Usage

shr(formula, data, eps = c(5, 5, 3), nknots=7,
irec = 0 , kappa0 = 10000, igraph = 1, maxiter = 200, hazard = "Weib",
print.iter = FALSE, na.action = na.omit)

Arguments

formula
a formula object with the response on the left of a $\texttildelow$ operator, and the terms on the right. The response must be a survival object or Hist object as returned by the 'Surv' or 'Hist' function.
data
a data frame in which to interpret the variables named in the formula.
eps
a vector of length 3 for the convergence criteria (criterion for parameters, criterion for likelihood, criterion for second derivatives). The default is 'c(5,5,3)' and corresponds to criteria equals to $10^{-5}$, $10^{-5}$ and $10^{-3}$.
nknots
number of knots for the splines to use to approximate the hazard function. Argument for the penalized likelihood approach. The default is 7.
irec
binary variable equals to 1 when search (by approximated cross validation) of the smoothing parameter kappa and 0 otherwise. Argument for the penalized likelihood approach. The default is 0.
kappa0
if irec=0, smoothing parameter; if irec=1, initial value of the smoothing parameters for the cross validation search. Argument for the penalized likelihood approach.
igraph
a binary variable equals to 1 when you want to output graph of the survival function, 0 otherwise. The default is 1.
maxiter
maximum number of iterations. The default is 200.
hazard
type of estimation method: "Splines" for a penalized likelihood approach with approximation of the hazard function by M-splines, "Weib" for a parametric approach with a Weibull distribution on the hazard function. Default is "Weib".
print.iter
boolean parameter. Equals to TRUE to print the likelihood during the iteration process, FALSE otherwise. Default is FALSE. This option is not running on Windows.
na.action
how NAs are treated. The default is first, any na.action attribute of data, second a na.action setting of options, and third 'na.fail' if that is unset. The 'factory-fresh' default is na.omit. Another possible value is NULL.

Value

  • call
  • coefregression parameters.
  • loglikvector containing the log-likelihood without and with covariate.
  • modelParWeibull parameters.
  • Nnumber of subjects.
  • NCnumber of covariates.
  • neventsnumber of events.
  • modelResponsemodel response: Hist or Surv object.
  • convergedinteger equal to 1 when the model converged, 2, 3 or 4 otherwise.
  • timetimes for which survival and hazard functions have been evaluated for plotting.
  • hazardmatched values of the hazard function.
  • lowerHazardlower confidence band for hazard function.
  • upperHazardupper confidence band for hazard function.
  • survmatched values of the survival function.
  • lowerSurvlower confidence band for survival function.
  • upperSurvupper confidence band for survival function.
  • RRvector of relative risks.
  • Vvariance-covariance matrix.
  • sestandart errors.
  • knotsknots to approximate by M-splines the hazard function.
  • nknotsnumber of knots.
  • ireca binary variable equals to 1 when search of the smoothing parameter kappa by approximated cross-validation, 1 otherwise. The default is 0.
  • niternumber of iterations.
  • cvvector containing the convergence criteria.
  • na.actionobservations deleted if missing values.

Details

The estimated parameters are obtained using the robust Marquardt algorithm (Marquardt, 1963) which is a combination between a Newton-Raphson algorithm and a steepest descent algorithm.

References

D. Marquardt (1963). An algorithm for least-squares estimation of nonlinear parameters. SIAM Journal of Applied Mathematics, 431-441.

See Also

shr, print.shrWeib, summary.shrWeib, print.shrPl, summary.shrPl

Examples

Run this code
# Weibull survival model 
data(test)
fit.su <- shr(Hist(time=list(l,r),id)~cov,data=test) 

## to print
fit.su

## summary
summary(fit.su)

Run the code above in your browser using DataLab